// console.log("hello");
// for (let x of [1, 2, 3]) {
//   console.log(x);
// }

function createElement(tagName, attributes, ...children) {
  let ele = document.createElement(tagName);
  // console.log(attributes);
  for (let p in attributes){
    ele.setAttribute(p,attributes[p])
  }
  
  for (let child of children) {
    if (typeof child === "string"){
      child = document.createTextNode(child)
    }
    ele.appendChild(child);
  }
  return ele;
}

document.body.appendChild(
  <div id="a"><p>Hello</p></div>
)
